#ifndef __STAGEMANAGER_H__
#define __STAGEMANAGER_H__

#include <Ogre.h>
#include <btBulletDynamicsCommon.h>
#include <list>
#include "BtOgrePG.h"
#include "BtOgreGP.h"
#include "BtOgreExtras.h"
#include "Stage.h"
#include "MyMotionState.h"
#include "Character.h"

#define QUERY_MASK_STAGE 1 << 2
#define LIGHT_MASK_STAGE 1 << 2

class StageManager : public Ogre::Singleton<StageManager> {

 private:

  // Atributos Bullet --------------------------------------------------

  btDiscreteDynamicsWorld* _pWorld;

  // Atributos Ogre ----------------------------------------------------

  Ogre::SceneManager* _pSceneManager;

  // Otros atributos ---------------------------------------------------

  std::list<Stage*> _stages;
  std::list<Stage*>::iterator _stagesIt;

 public:

  // Constructores y destructores --------------------------------------

  StageManager(btDiscreteDynamicsWorld* pWorld,
               Ogre::SceneManager* pSceneManager);
  ~StageManager();

  // Ogre::Singleton ---------------------------------------------------

  static StageManager& getSingleton();
  static StageManager* getSingletonPtr();

  // Factory -----------------------------------------------------------

  void createStage(const std::string stageMesh,
                   const std::string collisionMesh);

  // Lights ------------------------------------------------------------

  void setSceneShadow();
  void createMoon();
  void createStreetlight(const Ogre::Vector3 position);
};

#endif
